﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="MapTasks.aspx.cs" Inherits="AzureMRUI.MapTasks" %>
<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1 { font-size: large; }

        .style5 { font-size: small; }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <span class="style5"><strong>Map Tasks for </strong></span><strong>
                                                                   <asp:Label ID="Label1" runat="server" 
                                                                              style="font-weight: 700;" Text="JobID :" Width="56px" 
                                                                              CssClass="style5"></asp:Label>
                                                                   <asp:Label ID="Label2" runat="server" 
                                                                              style="font-weight: 700" CssClass="style5"></asp:Label>
                                                               </strong><span class="style5"><strong>&nbsp; 
                                                                                                 <br />
                                                                                             </strong>
                                                                            <asp:Chart ID="Chart1" runat="server" DataSourceID="ObjectDataSource1" 
                                                                                       Width="680px">
                                                                                <series>
                                                                                    <asp:Series Name="Series1" YValueMembers="MapTaskTime">
                                                                                    </asp:Series>
                                                                                </series>
                                                                                <chartareas>
                                                                                    <asp:ChartArea Name="ChartArea1">
                                                                                        <axisx maximum="100"  title="Map Task Index">
                                                                                        </axisx>
                                                                                        <axisy title="Task Time (ms)"></axisy>
                                                                                    </asp:ChartArea>
                                                                                </chartareas>
                                                                            </asp:Chart>
                                                                        </span><br />
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                  DataSourceID="ObjectDataSource1" Width="95%">
        <Columns>
            <asp:BoundField DataField="PartitionKey" HeaderText="i"  
                            SortExpression="PartitionKey" >
            </asp:BoundField>
            <asp:BoundField DataField="AppName" HeaderText="App" 
                            SortExpression="AppName" >
            </asp:BoundField>
            <asp:BoundField DataField="RowKey" HeaderText="Map ID" 
                            SortExpression="RowKey" />
            <asp:BoundField DataField="Attempt1StartTime" HeaderText="Start Time" 
                            SortExpression="Attempt1StartTime" />
            <asp:BoundField DataField="EndTime" HeaderText="End Time" 
                            SortExpression="EndTime" />
            <asp:BoundField DataField="MapTaskTime" HeaderText="Task Time" 
                            SortExpression="MapTaskTime" />
            <asp:TemplateField HeaderText="Status" SortExpression="TaskStatus">            
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# (((int) Eval("TaskStatus")) == 3
                                   ? "Done"
                                   : (((int) Eval("TaskStatus")) == 2 ? "Running" : "Pending")) %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:CheckBoxField DataField="ProcessedFromCache" HeaderText="Cache?" 
                               SortExpression="ProcessedFromCache" />
            <asp:BoundField DataField="Timestamp" HeaderText="Timestamp" 
                            SortExpression="Timestamp" />
        </Columns>
    </asp:GridView>
    <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
                          SelectMethod="GetMapTasks" TypeName="AzureMRCore.DataModel.MapTaskDataSource">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="" Name="jobID" QueryStringField="JobID" 
                                      Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <asp:ObjectDataSource ID="MapTaskDS" runat="server" SelectMethod="GetMapTasks" 
                          TypeName="AzureMRCore.DataModel.MapTaskDataSource">
        <SelectParameters>
            <asp:QueryStringParameter Name="jobID" QueryStringField="JobID" Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>
</asp:Content>